<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>workerAjax</title>
    <style>
        .fieldset{
            display: block;
            margin-bottom: 20px;
        }
        .response{
            padding: 20px;
            color: #232323;
        }
    </style>
</head>
<body>

    <fieldset>
        <legend>请求一</legend>
        <button onclick="test1()">发起</button>
        <div id="one" class="response">--</div>
    </fieldset>


    <fieldset>
        <legend>请求二</legend>
        <button onclick="test2()">发起</button>
        <div id="two" class="response">--</div>
    </fieldset>

<script src="workerAjax.js"></script>
<script>
    var request = new WorkerCenter();

    function test1(){
        request.http({
            type: 'post',
            url: "http://index.coinw.io/open/seckill/user/tops-info",
            success(data){
                document.getElementById("one").innerHTML = data;
            }
        })
    }
    function test2(){
        request.http({
            type: 'get',
            url: " http://index.coinw.io/open/coinw/trade/area/all",
            success(data){
                document.getElementById("two").innerHTML = data;
            }
        })
    }
</script>
</body>
</html>